package com.huawei;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * Description: HJ92 在字符串中找出连续最长的数字串
 * <p>
 * abcd12345ed125ss123058789
 * a8a72a6a5yy98y65ee1r2
 * 输出：
 * 123058789,9
 * 729865,2
 *
 * @author weiruibai.vendor
 * Date: 2022/8/22 16:10
 */
public class HJ92 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        List<String> list = new ArrayList<>();
        while ((str = br.readLine()) != null && str.length() != 0) { // ***
            list.add(str);
        }
        List<String> ans = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            str = list.get(i);
            char[] chars = str.toCharArray();
            int maxLength = -1;
            List<Obj> tmpAns = new ArrayList<>();
            for (int L = 0; L < chars.length; L++) {
                if (!Character.isDigit(chars[L])) {
                    continue;
                }
                int R = L + 1;
                while (R < chars.length && Character.isDigit(chars[R])) {
                    R++;
                }
                if (R - L < maxLength) {
                    L = R;
                    continue;
                }
                if (R - L > maxLength) {
                    tmpAns.clear();
                }
                Obj obj = new Obj();
                obj.startIndex = L;
                obj.endIndex = R;
                tmpAns.add(obj);
                maxLength = R - L;
                L = R;
            }
            StringBuilder sb = new StringBuilder();
            for (int j = 0; j < tmpAns.size(); j++) {
                Obj obj = tmpAns.get(j);
                sb.append(str, obj.startIndex, obj.endIndex);
            }
            sb.append(",").append(maxLength);
            ans.add(sb.toString());
        }
        for (int i = 0; i < ans.size(); i++) {
            System.out.println(ans.get(i));
        }
    }
}

/**
 * 保存起始坐标
 */
class Obj {
    public int startIndex;
    public int endIndex;
}
